<template>
	<view>
		<head-box></head-box>
		<view class="top">
			<view class="topl"><image src="../../static/img/hhjz.png" mode="aspectFit" ></image></view>
			<view class="top_cj">共计爱心捐赠<text class="tj">{{count}}</text>元</view>
		</view>
		<view class="top1">
			杭红捐赠刷新时间为5分钟
		</view>
		<view class="donations_list">
			<view class="donations_item" v-for="(item, index) in list" :key="index" @tap="gpSel" :data-id="item.id">
				<view class="wl">
					<image src="../../static/img/juanzengico.png" mode="scaleToFill"></image>
				</view>
				<view class="wc">
					<view class="donations_item_title">{{item.donateTitle}}</view>
					<view class="donations_item_time">{{item.donateTime}}</view>
				</view>
				<view class="wr">
					{{item.donateAmount}}元
				</view>
			</view>
		</view>
		<tabs-box></tabs-box>
	</view>
</template>

<script>
	import { gpUsertraceList } from '@/common/request.js';
	export default {
		data() {
			return {
				pageSize: 1000,
				pageNo:1,
				list:[],
				count:0,
			};
		},
		onLoad() {
			if(!uni.getStorageSync("token"))
			{
				uni.navigateTo({
					url:"../login/login"
				})
				return;
			}
			let params = {"column": "create_time","order": "desc"}
			gpUsertraceList(this.pageSize,this.pageNo,params).then(res => {
				if(res.success)
				{
					this.list = []
					res.result.records.forEach(ele => {
						this.list.push(ele)
						this.count +=  parseFloat(ele.donateAmount);
					})
				}
				//console.log(this.count);
				this.count = this.count.toFixed(2);
			});
		},
    onShow(){
      // #ifdef H5
      console.log('分享')
      this.$wxSetShare()
      // #endif
    },
	}
</script>

<style lang="scss">
	.top1{
		text-align: center;
		color: #cccccc;
		font-size: 20rpx;
		padding: 20rpx 0 0 0;
	}
	.top{
		display: flex;
		flex-direction: row;
		background-color: #f6f6f6;
		.topl{
			width: 300rpx;
			height: 100rpx;
			padding: 30rpx 0 0 20rpx;
			image{
				width: 100%;
				height: 100%;
			}
		}

		.top_cj
		{
			width: calc(100% - 300rpx);
			padding: 40rpx 30rpx;
			font-size: 30rpx;
			text-align: right;
			text{
				margin: 0 10rpx;
				font-weight: bold;
				color: #eeb73a;
			}
		}
	}

	.donations_list{
		padding: 0 30rpx;
		margin-bottom: 140rpx;
		.donations_item{
			text-align: left;
			color: #363636;
			display: flex;
			flex-direction: row;
			.wl{
				width: 110rpx;
				image{
					width: 80rpx;
					height: 80rpx;
					border-radius: 50%;
				}

				padding: 40rpx 0 20rpx 0;
			}
			.wr{
				width: 150rpx;
				font-size: 30rpx;
				text-align: right;
				border-bottom: 1px solid #f6f6f6;
				font-weight: bold;
				padding: 40rpx 0 20rpx 0;
			}
			.wc{
				width:calc(100% - 270rpx);
				border-bottom: 1px solid #f6f6f6;
				padding: 40rpx 0 20rpx 0;
				.donations_item_title{
					font-size: 30rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;

				}
				.donations_item_time{
					font-size: 24rpx;
					padding-top: 10rpx;
					color: #d1d1d1;
				}
			}
		}

	}
</style>
